package com.yuanfengPlus.basicInfoManage.supplierInfo.contorller;


import com.yuanfengPlus.basicInfoManage.supplierInfo.model.Supplierinfo;
import com.yuanfengPlus.basicInfoManage.supplierInfo.model.SupplierinfoDTO;
import com.yuanfengPlus.basicInfoManage.supplierInfo.service.impl.SupplierinfoImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@Api(tags ="供应商信息接口")
public class SupplierCon {
    @Autowired
    SupplierinfoImpl slil;
    @PostMapping("/selectSupplierAll")
    @ApiOperation(value = "查询供应商信息")
    public Result<PageResult> selectSupplierAll(@RequestBody SupplierinfoDTO supplierinfoDTO){
        return Result.success(slil.selectSupplierAll(supplierinfoDTO));
    }

    @PostMapping("/selectSupplier")
    @ApiOperation(value = "查询单个供应商信息")
    public Result<Supplierinfo> selectSupplier(String id){
        return slil.selectSupplier(id);
    }

    @PostMapping("/addSupplier")
    @ApiOperation(value = "添加供应商信息")
    public Result<String> addSupplier( @RequestBody Supplierinfo supplierinfo){
        return slil.addSupplier(supplierinfo);
    }

    @PostMapping("/updateSupplier")
    @ApiOperation(value = "修改供应商信息")
    public Result<String> updateSupplier(@RequestBody Supplierinfo supplierinfo){
        return slil.updateSupplier(supplierinfo);
    }
}
